package com.fashion.model;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;

/**
 * User: Administrator
 * Date: 11-8-25
 * Time: 下午10:59
 */
@Entity
@Table(name = "ABOUT_NEWS")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AboutNews {
    private String id;
    private News sourceNews;
    private News targetNews;

    @Id
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
    @JoinColumn(name = "news_source_id", nullable = false)
    public News getSourceNews() {
        return sourceNews;
    }

    public void setSourceNews(News sourceNews) {
        this.sourceNews = sourceNews;
    }

    @ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
    @JoinColumn(name = "news_target_id", nullable = false)
    public News getTargetNews() {
        return targetNews;
    }

    public void setTargetNews(News targetNews) {
        this.targetNews = targetNews;
    }

}
